//
//
//
#include "CGameClient.h"
#include "CClientLinker.h"


#pragma comment (lib, "ws2_32.lib")
#pragma comment (lib, "../irrNetLite/lib/irrNetLite.lib")

using namespace irr;
using namespace net;



void	CClientLinker::handlePacket(SInPacket& packet)
{

}


bool	CClientLinker::Init( char* server_ip /* = */ )
{
	m_pNetManager = irr::net::createIrrNetClient( this, server_ip );
	m_pNetManager->setVerbose(true);

	return true;
}

bool	CClientLinker::Update()
{
// 	if ( m_pNetManager->getConnectionStatus() == irr::net::EICS_FAILED )
// 	{
// 		return	false;
// 	}
	m_pNetManager->update();

	irr::net::SOutPacket packet;
	CGameClient* game = CGameClient::Instance();
	IAnimatedMeshSceneNode* avatar = game->GetAvatars(0);
	packet << avatar->getPosition();

	this->m_pNetManager->sendOutPacket( packet );


	return	true;
}


bool	CClientLinker::IsAlive()
{
	return	true;
}

